package com.example.active_mq;

import org.apache.activemq.ActiveMQConnectionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.stereotype.Component;

@Component
public class JmsTemplateConsumer {

    @Autowired
    private JmsTemplate jmsTemplate = new JmsTemplate(new ActiveMQConnectionFactory());

    public void receive() {
        System.out.println(jmsTemplate);
        Object message = jmsTemplate.receiveAndConvert("test");
        System.out.println(message.toString());
    }

}
